import { useState,useEffect } from "react";
import {useLocation} from "react-router-dom"
import {getSearch} from "../tools/ajax"
import {NavLink} from 'react-router-dom'
function Gds(){
    const location = useLocation()
    console.log(location.state,343333);
    let [shou,setShou] = useState([])
    async function aa(){
        let res = await getSearch({word:location.state.cai})
        shou = res.data
        setShou([...shou])
        console.log(shou);
    }
    useEffect(() => {
        aa();
      }, [location.state.cai]);
    return (
        <div className="list-box">{shou.map((item)=>{
            return (
                <NavLink to= "/title" state={item.Id}>
                <div className="bbd" key={item}>
                <img src={item.imageUrl} alt="" />
                <h4>{item.title}</h4>
                <p>
                   <span className="price">￥{item.priceStr}</span>
                   <span className="mack" v-html="item.mack"></span>
                </p>
             </div>
             </NavLink>
            )
        })}

        </div>
    )
}
export default Gds